<!DOCTYPE html>
<html>
<head>
    <title>Array Type Splice Example</title>
    <script type="text/javascript">
    
        var colors = ["red", "green", "blue"];
        var removed = colors.splice(0,1);              //remove the first item
        alert(colors);     //green,blue
        alert(removed);    //red - one item array
        
        removed = colors.splice(1, 0, "yellow", "orange");  //insert two items at position 1
        alert(colors);     //green,yellow,orange,blue
        alert(removed);    //empty array

        removed = colors.splice(1, 1, "red", "purple");    //insert two values, remove one
        alert(colors);     //green,red,purple,orange,blue
        alert(removed);    //yellow - one item array
        

    </script>
</head>
<body>

</body>
</html>